package com.commpany.servie.basic.order.service.write;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jiedianqian.system.exception.BusinessException;
import com.commpany.jiedianqian.system.exception.SystemErrorEnum;
import com.commpany.servie.basic.order.api.write.UserOrderWriteService;
import com.commpany.servie.basic.order.converter.UserOrderConverter;
import com.commpany.servie.basic.order.business.write.userOrder.UserOrderWriteManage;
import com.commpany.servie.basic.order.model.dto.userorder.UserOrderDTO;
@Slf4j
@Service("userOrderWriteService")
public class UserOrderWriteServiceImpl  implements UserOrderWriteService {
	@Autowired
	private UserOrderWriteManage userOrderWriteManage;
	
	public int insertUserOrderService( UserOrderDTO inputDTO ){
	   try {
	       return userOrderWriteManage.insertUserOrderService(UserOrderConverter.toPO(inputDTO));
	     } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
	}
    public int updateUserOrderService( UserOrderDTO inputDTO ){
       try {
           return userOrderWriteManage.updateUserOrderService(UserOrderConverter.toPO(inputDTO));
        } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
    }
    public int deleteUserOrderService( UserOrderDTO inputDTO ){
      try {
          return userOrderWriteManage.deleteUserOrderService(UserOrderConverter.toPO(inputDTO));
      } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
    }
}
	